/*******************************************************************************
 * Copyright (c) 2010 Mikhail Garber.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License (LGPL)
 * which accompanies this distribution
 * 
 * Contributors:
 *     Mikhail Garber - initial API and implementation
 ******************************************************************************/
package plumber.common;

import java.util.Collection;

/**
 * 
 * random utilities
 *
 */
public abstract class Utils {


	
	public static void validatePresent(Object value, String name) {
		if(value == null) {
			throw new IllegalStateException(String.format("%s is required", name));
		}
	}
	
	public static void validatePresentCollection(Collection<?> value, String name) {
		if(value == null) {
			throw new IllegalStateException(String.format("%s is required", name));
		}
		if(value.size() == 0) {
			throw new IllegalStateException(String.format("%s is required", name));
		}
	}
	
	
}
